home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / System 7.0 Samples / Edition Manager / EdSampdefines.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-18  |  6.3 KB  |  154 lines  |  [TEXT/MPS ]

  1. /* resource numbers */
  2. #define kAppleMenu 128
  3. #define kFileMenu 129
  4. #define kEditMenu 130
  5. #define kToolsMenu 131
  6. #define kAdditionalMenu 132
  7. #define kOurMenuBar 148
  8. #define kUndoStringsRes 1001
  9. #define kClipBoardStrings 1002
  10. #define kGeneralStrings 1003
  11. #define kNoMoreWindows 1000
  12. #define kDirtyAlert 1001
  13. #define kNoSize 1002
  14. #define kNoAppleEvents 1003
  15. #define kNoEditionManager 1004
  16. #define kCanxSub 1005
  17. #define kExpandedDITL 2000
  18. #define kExpandedSubDITL 2001
  19. #define kEdInfo 133
  20. #define kDocWindow 8888
  21. #define kClipWindow 128
  22. #define kNotInYet 134
  23. /* file menu constants */
  24. #define kNewItem 1
  25. #define kOpenItem 2
  26. #define kCloseItem 3
  27. #define kSaveItem 4
  28. #define kSaveAsItem 5
  29. #define blank1 6
  30. #define kPrintItem 7
  31. #define blank2 8
  32. #define kQuitItem 9
  33. #define    kResumeMask                1        /* bit of message field for resume vs. suspend */
  34. /* edit menu constants */
  35. #define kUndoItem 1
  36. #define blank4 2
  37. #define kCutItem 3
  38. #define kCopyItem 4
  39. #define kPasteItem 5
  40. #define kClearItem 6
  41. #define kPublishItem 8
  42. #define kSubscribeItem 9
  43. #define kSoptionsItem 10
  44. #define kBorders    11
  45. #define kClapNum 13 
  46. /* Tool menu constants */
  47. #define  kLineItem 1
  48. #define  kRectItem 2
  49. #define  kOvalItem 3
  50. #define  kTextBoxItem 4
  51. #define  kSelectItem 6
  52.  
  53. /* Additional menu item constants */
  54. #define kExpandedItem 1
  55. #define kGetSecInfo 2
  56. #define kEdSampFiles 3
  57.  
  58. /* drawing action codes */
  59. #define kNoAction 0
  60. #define kCantUndo 0
  61. #define kDrawLine 1
  62. #define kDrawRect 2
  63. #define kDrawOval 3
  64. #define kTextBox  4
  65. #define kSelectStuff 5
  66. #define kExtremeNeg -32768
  67. #define kExtremePos  32767 - 1                              /* required to address an old region bug */
  68. #define kNoEvents   0
  69. #define kOK 1
  70. #define kCancel 2
  71. #define flase false                                         /* don't ask */
  72. #define kSavedOnce 0x80                                       /* for publisher saved info */
  73. #define kNeverSaved 0
  74. #define kFakeKey 555    /* used in TextSections file */
  75. /* clipboard type content constants */
  76. enum { kClipUnused= 1,kClipEmpty,kClipHasPict,kClipHasText,kClipHasSub};
  77. /* constants for text section checking */
  78. enum {kKeyStroke=0,kAdding,kRemoving};
  79. enum {kLeftArrow=0x1c,kRightArrow,kUpArrow,kDownArrow};
  80. /* section types for my accounting */
  81. #define kPictType 0
  82. #define kTextType 1
  83. #define kCustomType 2
  84. #define kSectionDirty 0x80  /* a bit flag */
  85. /* my error codes */
  86. #define kMySecNotFound -80
  87.  
  88. /* Structures */
  89. struct myLine {                                             /* my own structure for defining a line */
  90.     Point start;
  91.     Point end;
  92. };
  93. typedef struct myLine myLine, *myLinePtr, **myLineHandle;
  94. #define rMyTextRecordType 'MTRT'
  95. #define rMyTextBlock 'MTBT'
  96. struct textSection {
  97.     struct textSection **nextSection;
  98.     Boolean publishing;  /* I don't really need to include this flag, but I would */
  99.                         /* rather do it here than dereferencing the section handle */
  100.                         /* all the time, makes the code a little more readable */
  101.     Boolean bordered;  /* this section should currently be bordered */
  102.     short startChar;
  103.     short endChar;
  104.     Handle    theText;
  105.     SectionHandle theSection;
  106.     unsigned long theID;
  107. };
  108. typedef struct textSection textSection, *textSectionPtr, **textSectionHandle;
  109. struct windowControl {
  110.     WindowPtr nextWindow;                                   /* next window in chain, or nil if last */
  111.     unsigned long windowID;                                 /* master ID number for section recording */
  112.     ProcPtr drawMe;                                         /* content drawing procedure pointer */
  113.     ProcPtr clickMe;                                        /* content click routine */
  114.     ProcPtr saveMe;                                         /* document save procedure pointer */
  115.     ProcPtr closeMe;                                        /* document close procedure pointer */
  116.     AliasHandle fileAliasHandle;                            /* alias for this document */
  117.     Handle rectList;                                        /* handle containing rects in this document */
  118.     short rectCount;                                        /* count of them */
  119.     Handle ovalList;                                        /* handle containing ovals in this document */
  120.     short ovalCount;                                        /* count of them */
  121.     myLineHandle lineList;                                  /* handle containing lines in this document */
  122.     short lineCount;                                        /* count of them */
  123.     Rect selectionRect;                                     /* currently selected area in document */
  124.     Boolean hasSelection;                                   /* is there a selection? */
  125.     short currentAction;                                    /* what mode is document in */
  126.     short undoAction;                                       /* last completed action */
  127.     Boolean windowDirty;
  128.     short numPubs;                                          /* count of active publishers */
  129.     Handle pubs;                                            /* handle containing section handles for publishers */
  130.     Handle pubRects;                                        /* where in the document the publisher is */
  131.     short numSubs;                                          /* count of active subscribers */
  132.     Handle subs;                                            /* handle containing section handles for subscribers */
  133.     Handle subRects;                                        /* where in the document the subscriber is */
  134.     Handle subDataHandle;                                   /* PICT data handles for each subscriber */
  135.     short numPicts;                                         /* number of non-sub PICTS */
  136.     Handle pictHandle;                                      /* handle to pic handles. This is needed when a user */
  137.     /* cancels a subscription, move the PICT to here */
  138.     Handle pictRects;                                       /* where in the document the subscriber is */
  139.     textSectionHandle textSections;
  140.     Rect textBox;
  141.     TEHandle boxHandle;
  142. };
  143. typedef struct windowControl windowControl, *windowCPtr, **windowCHandle;
  144.  
  145. /* Instead of using the handles I've used in the window structure, a */
  146. /* section list like this may be more helpful, particularly if you */
  147. /* will be working with a great many sections */
  148. struct mySectionData {
  149.     SectionHandle theSection;
  150.     Rect theRect;
  151.     Handle additionalData;
  152.     struct mySectionData **nextSection;
  153. };
  154. typedef struct mySectionData mySectionData, *mySectionDataPtr,**mySectionDataHandle;